package com.hqd.ch03.v37.web.context.request;

/**
 * request请求属性
 */
public interface RequestAttributes {

    int SCOPE_REQUEST = 0;

    int SCOPE_SESSION = 1;


    /**
     * request作用域
     */
    String REFERENCE_REQUEST = "request";
    /**
     * session作用域
     */
    String REFERENCE_SESSION = "session";

    Object getAttribute(String name, int scope);

    void setAttribute(String name, Object value, int scope);

    void removeAttribute(String name, int scope);

    String[] getAttributeNames(int scope);

    /**
     * 注册回调
     *
     * @param name
     * @param callback
     * @param scope
     */
    void registerDestructionCallback(String name, Runnable callback, int scope);

    /**
     * 处理引用类型
     *
     * @param key
     * @return
     */
    Object resolveReference(String key);

    /**
     * 获取SessionId
     *
     * @return
     */
    String getSessionId();

    /**
     * 获取Session同步锁
     *
     * @return
     */
    Object getSessionMutex();

}

